package com.power.sifa.std.dao;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.Repository;
import org.springframework.data.repository.query.Param;
import com.power.sifa.std.model.Std_comword;

import javax.transaction.Transactional;
import java.io.Serializable;
import java.util.List;

/**
 * 常用语 持久层(hibernate)
 */

public interface Std_comwordDao extends JpaRepository<Std_comword, Serializable>, JpaSpecificationExecutor<Std_comword>, Repository<Std_comword, Serializable>, Std_comwordDaoCustom<Std_comword, Serializable> {

    @Modifying
    @Transactional
    @Query("delete  from Std_comword s where  s.id in (:ids) ")
    void removeByIds(@Param("ids") List<Integer> ids);

    @Query("SELECT s FROM Std_comword s WHERE s.category = 1 AND s.status = 3200 AND s.createuserid IN :createuserid AND s.content LIKE %:content%")
    List<Std_comword> queryList(@Param("content") String content, @Param("createuserid") List<String> createuserid);

}
